# Maintainer: Dekedro <dekedro@protonmail.com>
pkgname=linux-apfs-rw-src
_modname=linux-apfs-rw
pkgver=0.3.8
pkgrel=0
pkgdesc="APFS module for linux, with experimental write support (sources, AKMS)"
url="https://github.com/linux-apfs/linux-apfs-rw"
arch="noarch"
license="GPL-2.0-only"
options="!check" # no tests
source="$_modname-$pkgver.tar.gz::https://github.com/linux-apfs/linux-apfs-rw/archive/refs/tags/v$pkgver.tar.gz"
builddir="$srcdir/$_modname-$pkgver"

prepare() {
	default_prepare

	cat > AKMBUILD <<- EOF
		modname=$_modname
		modver=$pkgver-r$pkgrel
		built_modules='apfs.ko'
	EOF
	printf '#define GIT_COMMIT\t"%s"\n' "$pkgver-alpine-r$pkgrel" > version.h
}

package() {
	install -Dm644 -t "$pkgdir/usr/src/$_modname-$pkgver" -- *.c *.h \
		Makefile AKMBUILD
	cp -a lzfse "$pkgdir/usr/src/$_modname-$pkgver/"
}

sha512sums="
09947f67827da4e3c6a8f4c3ba8de6ccceeee397fb8010771298a0207218d09ef47b9707125e8c29f78a2aa052f95e59f7f38d3a2e3864b4fb84ffb66ee6c575  linux-apfs-rw-0.3.8.tar.gz
"
